<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<title>My Web Application</title>
<meta  name="viewport" content="width=divice-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile.structure-1.4.5.min.css" />
<link rel="stylesheet" type="text/css" href="../themes/Theme_app.css">
<link rel="stylesheet" type="text/css" href="../themes/jquery.mobile.icons.min.css">
<link rel="stylesheet" type="text/css" href="../themes/Theme_app.min.css">
<link rel="stylesheet" type="text/css" href="../css/Css_Header.css">
<link rel="stylesheet" type="text/css" href="../css/table.css">
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head> 
<body> 

<div data-role="page" id="page">
	<div data-role="header">
		<h1>My Web Application</h1>
	</div>
    <div >
         <img src="../images/banner.jpg" width="1500" height="100">   
    </div> 
    <div align="center" id="container">
         แก้ไขคำถาม
    </div>
<?
    include('../connect/connect.php');
	$objDB = mysql_select_db("appdrivergame");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8"); 
mysql_query("SET character_set_connection=utf8");
	$objDB = mysql_select_db("table");
	$strSQL = "SELECT * FROM testing WHERE id = '".$_GET["id"]."' ";
	$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
	$objResult = mysql_fetch_array($objQuery);
?>
	<form name="form1" method="post" action="QuestUpdate.php?id=<?=$_GET["id"];?>" >
  
       <input type="text" name="Question" value="<?=$objResult["question"];?>"  placeholder="เพิ่มคำถามใหม่">
        <input type="text" name="c1" value="<?=$objResult["c1"];?>" placeholder="คำตอบข้อที่ 1">  
        <input type="text" name="c2" value="<?=$objResult["c2"];?>"placeholder="คำตอบข้อที่ 2">
        <input type="text" name="c3" value="<?=$objResult["c3"];?>"placeholder="คำตอบข้อที่ 3">
        <input type="text" name="c4" value="<?=$objResult["c4"];?>"placeholder="คำตอบข้อที่ 4">
        <input type="text" name="answer"  value="<?=$objResult["answer"];?>"placeholder="เฉลยคำตอบที่ถูกต้อง">
        <input name="btnSubmit" type="submit" value="บันทึกการแก้ไข">
	</form>        
     <input name="btncancel" type="button" value="ยกเลิกการแก้ไข" onClick="location.href='Padmin4.php'">     
    <br />

<?php 
	include('../connect/connect.php');
	$objDB = mysql_select_db("table");
$strSQL = "SELECT * FROM  testing order by id DESC";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table>
<?php
$i=0;
while($objResult = mysql_fetch_array($objQuery))
	{
		$i++;
?>
<tr>
<td>
<? echo "$i"; ?>
  : <?=$objResult["question"]; ?>
  </td>
</tr>
<tr>
<td>
ข้อ 1 <?=$objResult["c1"]; ?>
  </td>
</tr>
<tr>
<td>
ข้อ 2 <?=$objResult["c2"]; ?>
  </td>
</tr>
<tr>
<td>
ข้อ 3 <?=$objResult["c3"]; ?>
  </td>
</tr>
<tr>
<td>
ข้อ 4 <?=$objResult["c4"]; ?>
  </td>
</tr>	
<tr>
<td><font color="#FF0000">
เฉลยคำตอบ :
  <?=$objResult["answer"]; ?> </font>
  </td>
</tr>
<tr >
<td colspan="2" align="center"><a href="QuestionEdit.php?id=<?=$objResult["id"];?>">Edit</a>
<a href="JavaScript:if(confirm('Confirm Delete?')==true){window.location='QuestionDelete.php?id=<?php echo $objResult["id"];?>';}">Delete</a></td>
</tr>	
<tr height="10px">
</tr>
<?php 		
    }
?>
</table>
<div data-role="footer">
		<h4>@Computer Science</h4>
	</div>
</div>
</body>
</html>